package com.kotasoft.training.roogwteclipselink.client.managed.ui;

import com.google.gwt.text.shared.AbstractRenderer;

import com.kotasoft.training.roogwteclipselink.client.scaffold.place.ProxyListPlace;
import com.kotasoft.training.roogwteclipselink.client.managed.request.ApplicationEntityTypesProcessor;
import com.kotasoft.training.roogwteclipselink.client.managed.request.ProfesorProxy;
import com.kotasoft.training.roogwteclipselink.client.managed.request.MatriculaProxy;
import com.kotasoft.training.roogwteclipselink.client.managed.request.DireccionProxy;
import com.kotasoft.training.roogwteclipselink.client.managed.request.DepartamentoProxy;
import com.kotasoft.training.roogwteclipselink.client.managed.request.AsignaturaProxy;
import com.kotasoft.training.roogwteclipselink.client.managed.request.AlumnoProxy;

/**
 * Renders {@link ProxyListPlace}s for display to users.
 */
public class ApplicationListPlaceRenderer extends AbstractRenderer<ProxyListPlace> {

	public String render(ProxyListPlace object) {
		return new ApplicationEntityTypesProcessor<String>() {

			@Override
      public void handleProfesor(ProfesorProxy isNull) {
        setResult("Profesors");
      }
			@Override
      public void handleMatricula(MatriculaProxy isNull) {
        setResult("Matriculas");
      }
			@Override
      public void handleDireccion(DireccionProxy isNull) {
        setResult("Direccions");
      }
			@Override
      public void handleDepartamento(DepartamentoProxy isNull) {
        setResult("Departamentos");
      }
			@Override
      public void handleAsignatura(AsignaturaProxy isNull) {
        setResult("Asignaturas");
      }
			@Override
      public void handleAlumno(AlumnoProxy isNull) {
        setResult("Alumnos");
      }
		}.process(object.getProxyClass());
	}
}
